﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                     xmlns:theme="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero">
    <Style x:Key="{x:Type ScrollViewer}" 
           TargetType="{x:Type ScrollViewer}">
        <Setter Property="HorizontalScrollBarVisibility" Value="Hidden"/>
        <Setter Property="VerticalScrollBarVisibility" Value="Hidden"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ScrollViewer}">
                    <Grid>
                      
                            <ScrollContentPresenter 
                                    x:Name="PART_ScrollContentPresenter"
                                    Margin="{TemplateBinding Padding}"
                                    Content="{TemplateBinding Content}"
                                   />
                       
                        <Grid Background="{x:Null}">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            <ScrollBar 
                                    x:Name="PART_VerticalScrollBar"
                                    Grid.Column="1"
                                    Minimum="0.0"
                                    Maximum="{TemplateBinding ScrollableHeight}"
                                    ViewportSize="{TemplateBinding ViewportHeight}"
                                    Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=VerticalOffset, Mode=OneWay}"
                                    Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"         
                                    Cursor="Arrow"
                                    AutomationProperties.AutomationId="VerticalScrollBar"/>
                            <ScrollBar 
                                    x:Name="PART_HorizontalScrollBar"
                                    Orientation="Horizontal"
                                    Grid.Row="1"
                                    Minimum="0.0"
                                    Maximum="{TemplateBinding ScrollableWidth}"
                                    ViewportSize="{TemplateBinding ViewportWidth}"
                                    Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=HorizontalOffset, Mode=OneWay}"
                                    Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"
                                    Cursor="Arrow"
                                    AutomationProperties.AutomationId="HorizontalScrollBar"/>
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsEnabled" 
                     Value="true">
                <Setter Property="Foreground" 
                        Value="{StaticResource {x:Static SystemColors.GrayTextBrushKey}}"/>
            </Trigger>
            <Trigger Property="IsMouseOver"
                     Value="true">
                <Setter Property="HorizontalScrollBarVisibility"
                        Value="Visible"/>
                <Setter Property="VerticalScrollBarVisibility"
                        Value="Visible"/>
            </Trigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="ScrollBarButton"
           TargetType="{x:Type RepeatButton}">
        <Setter Property="OverridesDefaultStyle"
                Value="true"/>
        <Setter Property="Focusable"
                Value="true"/>
        <Setter Property="IsTabStop"
                Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Path x:Name="Arrow" HorizontalAlignment="Center" VerticalAlignment="Center" Fill="White"/>
                    <ControlTemplate.Triggers>
                        <Trigger Property="theme:ScrollChrome.ScrollGlyph" Value="UpArrow">
                            <Setter TargetName="Arrow" Property="Data" Value="M 3,0 l 3,8 l -6,0 Z"/>
                        </Trigger>
                        <Trigger Property="theme:ScrollChrome.ScrollGlyph" Value="DownArrow">
                            <Setter TargetName="Arrow" Property="Data" Value="M 0,0 l 6,0 l -3,8 Z"/>
                        </Trigger>
                        <Trigger Property="theme:ScrollChrome.ScrollGlyph" Value="LeftArrow">
                            <Setter TargetName="Arrow" Property="Data" Value="M 0,3 l 8,-3 l 0,6 Z"/>
                        </Trigger>
                        <Trigger Property="theme:ScrollChrome.ScrollGlyph" Value="RightArrow">
                            <Setter TargetName="Arrow" Property="Data" Value="M 0,0 l 8,3 l -8,3 Z"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="ScrollBarThumb"
           TargetType="{x:Type Thumb}">
        <Setter Property="OverridesDefaultStyle"
                Value="true"/>
        <Setter Property="IsTabStop"
                Value="true"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Border Background="#FF100C0C" CornerRadius="3"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="HorizontalScrollBarPageButton"
           TargetType="{x:Type RepeatButton}">
        <Setter Property="OverridesDefaultStyle"
                Value="true"/>
        <Setter Property="Background"
                Value="Transparent"/>
        <Setter Property="Focusable"
                Value="true"/>
        <Setter Property="IsTabStop"
                Value="true"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Rectangle Fill="#FFE5E5E5"
                               Width="{TemplateBinding Width}"
                               Height="{TemplateBinding Height}"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="VerticalScrollBarPageButton"
           TargetType="{x:Type RepeatButton}">
        <Setter Property="OverridesDefaultStyle"
                Value="true"/>
        <Setter Property="Background"
                Value="Transparent"/>
        <Setter Property="Focusable"
                Value="true"/>
        <Setter Property="IsTabStop"
                Value="true"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Rectangle Fill="#FFE5E5E5"
                               Width="{TemplateBinding Width}"
                               Height="{TemplateBinding Height}"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="{x:Type ScrollBar}"
           TargetType="{x:Type ScrollBar}">
        <Setter Property="Background"
                Value="Black"/>
        <Setter Property="Stylus.IsPressAndHoldEnabled"
                Value="false"/>
        <Setter Property="Stylus.IsFlicksEnabled"
                Value="false"/>
        <Setter Property="Foreground"
                Value="{StaticResource {x:Static SystemColors.ControlTextBrushKey}}"/>
        <Setter Property="Width"
                Value="{StaticResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>
        <Setter Property="MinWidth"
                Value="{StaticResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>
        <Setter Property="Margin"
                Value="2"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ScrollBar}">
                    <Border 
                            x:Name="Bg"
                            CornerRadius="2"                         
                            Margin="2"
                            Opacity="0.75"
                            Background="{TemplateBinding Background}"
                            VerticalAlignment="Bottom">
                        <Grid
                                SnapsToDevicePixels="true">
                            <Grid.RowDefinitions>
                                <RowDefinition MaxHeight="{StaticResource {x:Static SystemParameters.VerticalScrollBarButtonHeightKey}}"/>
                                <RowDefinition MaxHeight="{StaticResource {x:Static SystemParameters.VerticalScrollBarButtonHeightKey}}"/>
                            </Grid.RowDefinitions>
                            <RepeatButton
                                    Style="{StaticResource ScrollBarButton}"
                                    Background="#FF726767"                                    
                                    IsEnabled="{TemplateBinding IsMouseOver}"
                                    Command="{x:Static ScrollBar.LineUpCommand}"
                                    theme:ScrollChrome.ScrollGlyph="UpArrow"
                                    Margin="0,4"/>
                            <RepeatButton                   
                                    Style="{StaticResource ScrollBarButton}"
                                    Background="#FF696767"
                                    Grid.Row="1"
                                    IsEnabled="{TemplateBinding IsMouseOver}"
                                    Command="{x:Static ScrollBar.LineDownCommand}"
                                    theme:ScrollChrome.ScrollGlyph="DownArrow"
                                    Margin="0,4">
                            </RepeatButton>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled"
                                 Value="false">
                            <Setter TargetName="Bg"
                                    Property="Visibility"
                                    Value="Hidden"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsMouseOver" Value="True"/>
                    <Condition Property="Orientation" Value="Vertical"/>
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter Property="Width"
                            Value="25"/>
                    <Setter
                            Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type ScrollBar}">
                                <Border 
                                        CornerRadius="4"                         
                                        Margin="2"
                                        Opacity="0.75"
                                        Background="{TemplateBinding Background}">
                                    <Grid
                                            SnapsToDevicePixels="true">
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="0.00001*"/>
                                            <RowDefinition MaxHeight="{StaticResource {x:Static SystemParameters.VerticalScrollBarButtonHeightKey}}"/>
                                            <RowDefinition MaxHeight="{StaticResource {x:Static SystemParameters.VerticalScrollBarButtonHeightKey}}"/>
                                        </Grid.RowDefinitions>
                                        <Track
                                                Name="PART_Track"
                                                IsEnabled="{TemplateBinding IsMouseOver}"
                                                IsDirectionReversed="true">
                                            <Track.DecreaseRepeatButton>
                                                <RepeatButton Style="{StaticResource VerticalScrollBarPageButton}"
                                                        Command="{x:Static ScrollBar.PageUpCommand}"/>
                                            </Track.DecreaseRepeatButton>
                                            <Track.IncreaseRepeatButton>
                                                <RepeatButton Style="{StaticResource VerticalScrollBarPageButton}"
                                                        Command="{x:Static ScrollBar.PageDownCommand}"/>
                                            </Track.IncreaseRepeatButton>
                                            <Track.Thumb>
                                                <Thumb Style="{StaticResource ScrollBarThumb}"
                                                        theme:ScrollChrome.ScrollGlyph="VerticalGripper"
                                                        Margin="2"/>
                                            </Track.Thumb>
                                        </Track>
                                        <RepeatButton
                                                Style="{StaticResource ScrollBarButton}"
                                                Background="#FFFFFFFF"
                                                Grid.Row="1"
                                                IsEnabled="{TemplateBinding IsMouseOver}"
                                                Command="{x:Static ScrollBar.LineUpCommand}"
                                                theme:ScrollChrome.ScrollGlyph="UpArrow"
                                                RenderTransformOrigin="0.5, 0.5">
                                            <RepeatButton.RenderTransform>
                                                <ScaleTransform ScaleX="1.5" ScaleY="1.5"/>
                                            </RepeatButton.RenderTransform>
                                        </RepeatButton>
                                        <RepeatButton                           
                                                Style="{StaticResource ScrollBarButton}"
                                                Background="#FFFFFFFF"
                                                Grid.Row="2"
                                                IsEnabled="{TemplateBinding IsMouseOver}"
                                                Command="{x:Static ScrollBar.LineDownCommand}"
                                                theme:ScrollChrome.ScrollGlyph="DownArrow"
                                                RenderTransformOrigin="0.5, 0.5">
                                            <RepeatButton.RenderTransform>
                                                <ScaleTransform ScaleX="1.5" ScaleY="1.5"/>
                                            </RepeatButton.RenderTransform>
                                        </RepeatButton>
                                    </Grid>
                                </Border>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </MultiTrigger.Setters>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="Orientation" Value="Horizontal"/>
                    <Condition Property="IsMouseOver" Value="False"/>
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter Property="Width"
                            Value="Auto"/>
                    <Setter Property="MinWidth"
                            Value="0"/>
                    <Setter Property="Height"
                            Value="{StaticResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}"/>
                    <Setter Property="MinHeight"
                            Value="{StaticResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}"/>
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type ScrollBar}">
                                <Border 
                                        x:Name="Bg"
                                        CornerRadius="2"                         
                                        Margin="2"
                                        Opacity="0.75"
                                        Background="{TemplateBinding Background}"
                                        HorizontalAlignment="Right">
                                    <Grid
                                            SnapsToDevicePixels="true">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition MaxWidth="{StaticResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}"/>
                                            <ColumnDefinition MaxWidth="{StaticResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}"/>
                                        </Grid.ColumnDefinitions>
                                        <RepeatButton
                                                Style="{StaticResource ScrollBarButton}"    
                                                Background="#FF585555"
                                                IsEnabled="{TemplateBinding IsMouseOver}"
                                                Command="{x:Static ScrollBar.LineLeftCommand}"
                                                theme:ScrollChrome.ScrollGlyph="LeftArrow"
                                                Margin="4,0"/>
                                        <RepeatButton
                                                Style="{StaticResource ScrollBarButton}"                                        
                                                Background="#FFCBCBCB"
                                                Grid.Column="1"
                                                IsEnabled="{TemplateBinding IsMouseOver}"
                                                Command="{x:Static ScrollBar.LineRightCommand}"
                                                theme:ScrollChrome.ScrollGlyph="RightArrow"
                                                Margin="4,0"/>
                                    </Grid>
                                </Border>
                                <ControlTemplate.Triggers>
                                    <Trigger Property="IsEnabled"
                                             Value="false">
                                        <Setter TargetName="Bg"
                                                Property="Visibility"
                                                Value="Hidden"/>
                                    </Trigger>
                                </ControlTemplate.Triggers>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </MultiTrigger.Setters>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsMouseOver" Value="True"/>
                    <Condition Property="Orientation" Value="Horizontal"/>
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter Property="Width"
                            Value="Auto"/>
                    <Setter Property="MinWidth"
                            Value="0"/>
                    <Setter Property="Height"
                            Value="{StaticResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}"/>
                    <Setter Property="MinHeight"
                            Value="{StaticResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}"/>
                    <Setter Property="Height"
                            Value="25"/>
                    <Setter
                            Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type ScrollBar}">
                                <Border 
                                        CornerRadius="4"                         
                                        Margin="2"
                                        Opacity="0.75"
                                        Background="{TemplateBinding Background}">
                                    <Grid
                                            SnapsToDevicePixels="true">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="0.00001*"/>
                                            <ColumnDefinition MaxWidth="{StaticResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}"/>
                                            <ColumnDefinition MaxWidth="{StaticResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}"/>
                                        </Grid.ColumnDefinitions>
                                        <Track
                                                Name="PART_Track"
                                                IsEnabled="{TemplateBinding IsMouseOver}">
                                            <Track.DecreaseRepeatButton>
                                                <RepeatButton Style="{StaticResource HorizontalScrollBarPageButton}"
                                                      Command="{x:Static ScrollBar.PageLeftCommand}"/>
                                            </Track.DecreaseRepeatButton>
                                            <Track.IncreaseRepeatButton>
                                                <RepeatButton Style="{StaticResource HorizontalScrollBarPageButton}"
                                                      Command="{x:Static ScrollBar.PageRightCommand}"/>
                                            </Track.IncreaseRepeatButton>
                                            <Track.Thumb>
                                                <Thumb x:Name="Thumb" Style="{StaticResource ScrollBarThumb}"
                                                       theme:ScrollChrome.ScrollGlyph="HorizontalGripper"
                                                       Margin="2"/>
                                            </Track.Thumb>
                                        </Track>
                                        <RepeatButton
                                                Style="{StaticResource ScrollBarButton}"
                                                Background="#FFFFFFFF"
                                                Grid.Column="1"
                                                IsEnabled="{TemplateBinding IsMouseOver}"
                                                Command="{x:Static ScrollBar.LineLeftCommand}"
                                                theme:ScrollChrome.ScrollGlyph="LeftArrow"
                                                RenderTransformOrigin="0.5, 0.5">
                                            <RepeatButton.RenderTransform>
                                                <ScaleTransform ScaleX="1.5" ScaleY="1.5"/>
                                            </RepeatButton.RenderTransform>
                                        </RepeatButton>
                                        <RepeatButton                           
                                                Style="{StaticResource ScrollBarButton}"
                                                Background="#FFFFFFFF"
                                                Grid.Column="2"
                                                IsEnabled="{TemplateBinding IsMouseOver}"
                                                Command="{x:Static ScrollBar.LineRightCommand}"
                                                theme:ScrollChrome.ScrollGlyph="RightArrow"
                                                RenderTransformOrigin="0.5, 0.5">
                                            <RepeatButton.RenderTransform>
                                                <ScaleTransform ScaleX="1.5" ScaleY="1.5"/>
                                            </RepeatButton.RenderTransform>
                                        </RepeatButton>
                                    </Grid>
                                </Border>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </MultiTrigger.Setters>
            </MultiTrigger>
        </Style.Triggers>
    </Style>
    <!--</SnippetScrollViewer>-->
</ResourceDictionary>